path = "/root/github/internet_product_safe_test/snortrules"

from imp import reload
import sys
reload(sys)

sys.path.append(path)
import codecs
all_msg_list = []
# 指定使用utf-8字符集读取文件内容
f = codecs.open('/root/github/internet_product_safe_test/snortrules/protocol/oneRule_2.rules', 'r', 'utf-8')
# 使用for循环遍历文件对象
for line in f:
    position_1 = line.index('"')
    position_2 = line.index('"', position_1 + 1)
    new_msg = line[position_1 + 1 : position_2]
    all_msg_list.append(new_msg)
f.close()
print(all_msg_list.index('PROTOCOL-FTP PUT overflow attempt'))